              package com.java.diagnostics.visualizer.impl.axes;
              
              import com.java.diagnostics.visualizer.impl.util.Messages;
              import java.util.HashMap;
              import java.util.Map;
              
              public class AxisUnits
              {
                private static final String UNIT_PREFIX = "AxisUnits.";
                private static final String PERCENT_VALUE = "%";
                private static final String HASH_VALUE = "#";
                private static final String GC_COUNT_VALUE = "gc count";
                private static final String NUMBER_OF_FLIPS_VALUE = "number of flips";
                private static final String COLLECTION_TYPE_VALUE = "collection type";
                private static final String REASON_CODE_VALUE = "reason code";
                private static final String TYPE_CODE_VALUE = "scope code";
                private static final String EVENT_CODE_VALUE = "event code";
                private static final String EVENT_TYPE_VALUE = "event type";
                private static final String ACTION_CODE_VALUE = "action code";
                private static final Map<String, String> unitsToKeys = new HashMap();
                private static final String HASH_SIGN_KEY = "AxisUnits.number.sign";
                public static final String HASH_SIGN = Messages.getString("AxisUnits.number.sign");
                private static final String HUNDREDS_KEY = "AxisUnits.100s";
                public static final String HUNDREDS = Messages.getString("AxisUnits.100s");
                private static final String TIMES_SIGN_KEY = "AxisUnits.x";
                public static final String TIMES_SIGN = Messages.getString("AxisUnits.x");
                private static final String GC_COUNT_KEY = "AxisUnits.gc.number";
                public static final String GC_COUNT = Messages.getString("AxisUnits.gc.number");
                private static final String PERCENT_SIGN_KEY = "AxisUnits.percent.sign";
                public static final String PERCENT_SIGN = Messages.getString("AxisUnits.percent.sign");
                private static final String OBJECTS_KEY = "AxisUnits.objects";
                public static final String OBJECTS = Messages.getString("AxisUnits.objects");
                private static final String BYTES_KEY = "AxisUnits.bytes";
                public static final String BYTES;
                private static final String KB_KEY = "AxisUnits.KB";
                public static final String KB;
                private static final String MB_KEY = "AxisUnits.MB";
                public static final String MB;
                private static final String GB_KEY = "AxisUnits.GB";
                public static final String GB;
                private static final String MICROSECONDS_KEY = "AxisUnits.us";
                public static final String MICROSECONDS;
                private static final String MILLISECONDS_KEY = "AxisUnits.ms";
                public static final String MILLISECONDS;
                private static final String SECONDS_KEY = "AxisUnits.seconds";
                public static final String SECONDS;
                private static final String MINUTES_KEY = "AxisUnits.minutes";
                public static final String MINUTES;
                private static final String HOURS_KEY = "AxisUnits.hours";
                public static final String HOURS;
                private static final String DAYS_KEY = "AxisUnits.days";
                public static final String DAYS;
                private static final String DATE_KEY = "AxisUnits.date";
                public static final String DATE;
                private static final String COLLECTION_TYPE_KEY = "AxisUnits.collection.type";
                public static final String COLLECTION_TYPE;
                private static final String ACTION_CODE_KEY = "AxisUnits.action.code";
                public static final String ACTION_CODE;
                private static final String REASON_CODE_KEY = "AxisUnits.reason.code";
                public static final String REASON_CODE;
                private static final String EVENT_CODE_KEY = "AxisUnits.event.code";
                public static final String EVENT_CODE;
                private static final String QUANTUM_TYPE_CODE_KEY = "AxisUnits.quantum.type.code";
                public static final String QUANTUM_TYPE_CODE;
                public static final String QUANTUM_TYPE;
                private static final String EVENT_TYPE_KEY = "AxisUnits.event.type";
                public static final String EVENT_TYPE;
                private static final String TYPE_CODE_KEY = "AxisUnits.type.code";
                public static final String TYPE_CODE;
                private static final String REGION_KEY = "AxisUnits.region";
                public static final String REGION;
                private static final String NUMBER_OF_FLIPS_KEY = "AxisUnits.number.of.flips";
                public static final String NUMBER_OF_FLIPS;
                private static final String NUMBER_FLIPPED_KEY = "AxisUnits.number.flipped";
                public static final String NUMBER_FLIPPED;
              
                static
                {
                  unitsToKeys.put(HASH_SIGN, "AxisUnits.number.sign");
                  unitsToKeys.put(HUNDREDS, "AxisUnits.100s");
                  unitsToKeys.put(TIMES_SIGN, "AxisUnits.x");
                  unitsToKeys.put(GC_COUNT, "AxisUnits.gc.number");
                  unitsToKeys.put(PERCENT_SIGN, "AxisUnits.percent.sign");
                  unitsToKeys.put(OBJECTS, "AxisUnits.objects");
              
                  BYTES = Messages.getString("AxisUnits.bytes");
              
                  KB = Messages.getString("AxisUnits.KB");
              
                  MB = Messages.getString("AxisUnits.MB");
              
                  GB = Messages.getString("AxisUnits.GB");
              
                  unitsToKeys.put(BYTES, "AxisUnits.bytes");
                  unitsToKeys.put(KB, "AxisUnits.KB");
                  unitsToKeys.put(MB, "AxisUnits.MB");
                  unitsToKeys.put(GB, "AxisUnits.GB");
              
                  MICROSECONDS = 
                    Messages.getString("AxisUnits.us");
              
                  MILLISECONDS = 
                    Messages.getString("AxisUnits.ms");
              
                  SECONDS = Messages.getString("AxisUnits.seconds");
              
                  MINUTES = Messages.getString("AxisUnits.minutes");
              
                  HOURS = Messages.getString("AxisUnits.hours");
              
                  DAYS = Messages.getString("AxisUnits.days");
              
                  DATE = Messages.getString("AxisUnits.date");
              
                  unitsToKeys.put(MICROSECONDS, "AxisUnits.us");
                  unitsToKeys.put(MILLISECONDS, "AxisUnits.ms");
                  unitsToKeys.put(SECONDS, "AxisUnits.seconds");
                  unitsToKeys.put(MINUTES, "AxisUnits.minutes");
                  unitsToKeys.put(HOURS, "AxisUnits.hours");
                  unitsToKeys.put(DAYS, "AxisUnits.days");
                  unitsToKeys.put(DATE, "AxisUnits.date");
              
                  COLLECTION_TYPE = 
                    Messages.getString("AxisUnits.collection.type");
              
                  ACTION_CODE = 
                    Messages.getString("AxisUnits.action.code");
              
                  REASON_CODE = 
                    Messages.getString("AxisUnits.reason.code");
              
                  EVENT_CODE = Messages.getString("AxisUnits.event.code");
              
                  QUANTUM_TYPE_CODE = 
                    Messages.getString("AxisUnits.quantum.type.code");
                  QUANTUM_TYPE = 
                    Messages.getString("AxisUnits.quantum.type");
              
                  EVENT_TYPE = Messages.getString("AxisUnits.event.type");
              
                  TYPE_CODE = Messages.getString("AxisUnits.type.code");
              
                  REGION = Messages.getString("AxisUnits.region");
              
                  NUMBER_OF_FLIPS = 
                    Messages.getString("AxisUnits.number.of.flips");
              
                  NUMBER_FLIPPED = 
                    Messages.getString("AxisUnits.number.flipped");
              
                  unitsToKeys.put(COLLECTION_TYPE, "AxisUnits.collection.type");
                  unitsToKeys.put(ACTION_CODE, "AxisUnits.action.code");
                  unitsToKeys.put(REASON_CODE, "AxisUnits.reason.code");
                  unitsToKeys.put(EVENT_CODE, "AxisUnits.event.code");
                  unitsToKeys.put(EVENT_TYPE, "AxisUnits.event.type");
                  unitsToKeys.put(TYPE_CODE, "AxisUnits.type.code");
                  unitsToKeys.put(REGION, "AxisUnits.region");
                  unitsToKeys.put(NUMBER_FLIPPED, "AxisUnits.number.flipped");
                  unitsToKeys.put(NUMBER_OF_FLIPS, "AxisUnits.number.of.flips");
                }
              
                public static String getPreferenceKey(String units)
                {
                  String key = (String)unitsToKeys.get(units);
                  if (key == null) {
                    return units;
                  }
                  return key;
                }
              
                public static String getUnits(String preferenceKey) {
                  String units = Messages.getString(preferenceKey);
                  if (units.charAt(0) != '!') {
                    return units;
                  }
              
                  if (preferenceKey.equals("%"))
                    return PERCENT_SIGN;
                  if (preferenceKey.equals("#"))
                    return HASH_SIGN;
                  if (preferenceKey.equals("gc count"))
                    return GC_COUNT;
                  if (preferenceKey.equals("collection type"))
                    return COLLECTION_TYPE;
                  if (preferenceKey.equals("reason code"))
                    return REASON_CODE;
                  if (preferenceKey.equals("scope code"))
                    return TYPE_CODE;
                  if (preferenceKey.equals("event code"))
                    return EVENT_CODE;
                  if (preferenceKey.equals("event type"))
                    return EVENT_TYPE;
                  if (preferenceKey.equals("action code"))
                    return ACTION_CODE;
                  if (preferenceKey.equals("number of flips")) {
                    return NUMBER_OF_FLIPS;
                  }
              
                  String key = "AxisUnits." + preferenceKey;
                  units = Messages.getString(key);
                  if (units.charAt(0) != '!') {
                    return units;
                  }
              
                  return preferenceKey;
                }
              }

